1 : <?php
2 : /*--------------------------------------------------------------------------+
3 : This file is part of eStudy.
4 : user/classes/class.editcontact.inc.php
5 : - Modulgruppe: Benutzerverwaltung
6 : - Beschreibung: BESCHREIBUNG
7 : - Version: 0.1, 02/07/04
8 : - Autor(en): Mirko Pitz <mirko.pitz@mni.fh-giessen.de>
9 : +---------------------------------------------------------------------------+
10 : This program is free software; you can redistribute it and/or
11 : modify it under the terms of the GNU General Public License
12 : as published by the Free Software Foundation; either version 2
13 : of the License, or any later version.
14 : +---------------------------------------------------------------------------+
15 : This program is distributed in the hope that it will be useful,
16 : but WITHOUT ANY WARRANTY; without even the implied warranty of
17 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 : GNU General Public License for more details.
19 : You should have received a copy of the GNU General Public License
20 : along with this program; if not, write to the Free Software
21 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 : +--------------------------------------------------------------------------*/
23 : /**
24 : * In dieser Datei wird die Klasse "EditContact" implementiert.
25 : * @package eStudy.User
26 : * @author Mirko Pitz <mirko.pitz@mni.fh-giessen.de>
27 : * @version 0.1, 02/07/04
28 : */
29 : /**Basis-Klasse*/
30 1 : require_once ("class.contact.inc.php");
31 : /**
32 : * BESCHREIBUNG
33 : * @package eStudy.User
34 : * @author Mirko Pitz <mirko.pitz@mni.fh-giessen.de>
35 : * @version 0.1, 02/07/04
36 : */
37 1 : class EditContact extends Contact {
38 : /**
39 : * Konstruktor
40 : *
41 : * @access public
42 : * @param TYP VARIABLENNAME - BESCHREIBUNG
43 : * @return TYP BESCHREIBUNG
44 : */
45 : function EditContact($userID, $contactID) {
46 0 : $this->Contact($userID, $contactID);
47 0 : }
48 : /**
49 : * KURZBESCHREIBUNG
50 : *
51 : * BESCHREIBUNG
52 : * @access public
53 : * @param TYP VARIABLENNAME - BESCHREIBUNG
54 : * @return TYP BESCHREIBUNG
55 : */
56 : function echoContactTable() {
57 0 : $editScript = "editcontact.php";
58 0 : $deleteScript = "deletecontact.php";
59 0 : if (is_array($this->contactData)) {
60 0 : $showText = array(0 => 'Keine', 1 => 'Portal', 2 => 'Kurse', 3 => 'spez. Kurs');
61 : //Tabellen Überschrift
62 0 : $code = "<tr>";
63 0 : $code.= "<td class='tableCellHead'>";
64 0 : $code.= "</td>";
65 0 : $code.= "<td class='tableCellHead'>";
66 0 : $code.= "Adresse";
67 0 : $code.= "</td>";
68 0 : $code.= "<td class='tableCellHead'>";
69 0 : $code.= "Anzeige";
70 0 : $code.= "</td>";
71 0 : $code.= "<td class='tableCellHead'>";
72 0 : $code.= "</td>";
73 0 : $code.= "<td class='tableCellHead'>";
74 0 : $code.= "</td>";
75 0 : $code.= "</tr>";
76 : //Neue Zeile beginnen
77 0 : foreach($this->contactData as $contactDate) {
78 : //AnzeigeFlag auswerten
79 0 : if ($contactDate->showflag == 0) {
80 0 : $contactShowText = $showText[0];
81 0 : } elseif ($contactDate->showflag == 1) {
82 0 : $contactShowText = $showText[1];
83 0 : } elseif ($contactDate->showflag == 2) {
84 0 : $contactShowText = $showText[2];
85 0 : } else {
86 0 : $contactShowText = $showText[3];
87 : }
88 : //Bearbeiten-Link
89 0 : $editLink = "<a href='".$editScript."?user=".$this->userID."&adr=".$contactDate->contactID."'>".Output::getIcon('icon_edit', 'Kontaktangabe bearbeiten') ."</a>";
90 : //Löschen-Link
91 0 : $deleteLink = "<a href='".$deleteScript."?user=".$this->userID."&adr=".$contactDate->contactID."'>".Output::getIcon('icon_delete', 'Kontaktangabe löschen') ."</a>";
92 0 : $code.= "<tr>";
93 0 : $code.= "<td align='left' class='tableCell'><b>".$contactDate->name."</b></td>";
94 0 : $code.= "<td align='left' class='tableCell'>".Data::toHTML($contactDate->value, false) ."</td>";
95 0 : $code.= "<td class='tableCell'>$contactShowText</td>";
96 0 : $code.= "<td class='tableCell'>$editLink</td>";
97 0 : $code.= "<td class='tableCell'>$deleteLink</td>";
98 0 : $code.= "</tr>";
99 0 : }
100 0 : } else {
101 0 : $code = "<tr>";
102 0 : $code.= "<td align='center' class='tableCell'>Keine Adressen vorhanden</td>";
103 0 : $code.= "</tr>";
104 : }
105 0 : echo $code;
106 0 : }
107 : /**
108 : *
109 : * @access public
110 : * @return void
111 : *
112 : */
113 : function newContactDialog() {
114 : //Optionsgruppen
115 0 : $showOptions = UserTools::getShowOptions($this->userID);
116 0 : $contactOptions = $this->getFreeContactOptions();
117 : //Formularkopf
118 0 : $code = "<tr><td class='tableCell'><form action='".$this->actionScript."' method='post'><table class='tableBorder' style='width:100%;'>";
119 : //zunächst leerer Datensatz
120 0 : $code.= UserTools::getOptionFormField("Adresstyp", "contacttypeID", $this->newContact['contacttypeID'], $contactOptions, $this->styles, 300, 1);
121 0 : $code.= UserTools::getEditFormField("Adresse", "value", $this->newContact['value'], 40, 128, $this->styles, 0, 300, 2);
122 0 : $code.= UserTools::getSmallInfoText("Die erlaubten Zeichen sind abhängig vom ausgewählten Typ.", "tableCellSmall");
123 : //Einstellungen
124 0 : $code.= UserTools::getOptionFormField("Anzeige", "showFlag", $this->newContact['showFlag'], $showOptions, $this->styles, 300, 3);
125 : //hr
126 0 : $code.= "<tr><td class='tableCell' colspan='3'>\n";
127 0 : $code.= "<hr /></td></tr>\n";
128 : // buttons
129 0 : $code.= "<tr><td class='tableCell' colspan='3'>\n";
130 0 : $code.= "<div style='text-align:center;'>\n";
131 0 : $code.= "<p class='pForm'><input type='reset' value='Zurücksetzen'/></p>\n";
132 0 : $code.= "<p class='pForm'><input type='submit' name='newContact' value='Speichern'/></p>\n";
133 0 : $code.= "</div></td></tr>\n";
134 0 : $code.= "</table>\n";
135 0 : $code.= "</form></td></tr>\n";
136 0 : echo $code;
137 0 : }
138 : /**
139 : *
140 : * @access public
141 : * @return void
142 : *
143 : */
144 : function editContactDialog() {
145 0 : $heading1 = $this->contact['name'];
146 0 : $heading2 = "Einstellungen";
147 : //Optionsgruppen
148 0 : $showOptions = UserTools::getShowOptions($this->userID);
149 0 : $contactOptions = $this->getFreeContactOptions();
150 0 : $allowedChars = $this->contact['allowedchars'];
151 0 : $specialType = $this->contact['type'];
152 : //Info-Text bereitstellen
153 0 : if ($specialType) {
154 0 : if ($specialType == 1) {
155 0 : $infoText = "Muss gültige E-Mail sein.";
156 0 : } elseif ($specialType == 2) {
157 0 : $infoText = "Muss gültige URL sein.";
158 0 : } else {
159 0 : $infoText = "Alle Zeichen sind erlaubt.";
160 : }
161 0 : } elseif ($allowedChars) {
162 0 : $infoText = "Erlaubte Zeichen sind $allowedChars.";
163 0 : } else {
164 0 : $infoText = "Alle Zeichen sind erlaubt.";
165 : }
166 : //Formularkopf
167 0 : $code = "<tr><td><form action='".$this->actionScript."' method='post'><table>";
168 : //Felder
169 0 : $code.= UserTools::getFormSubHeader($heading1, "tableSubHeaderDark", 3);
170 0 : $code.= UserTools::getEditFormField("Adresse", "value", $this->contact['value'], 40, 128, $this->styles, 0, 300, 2);
171 0 : $code.= UserTools::getSmallInfoText($infoText, "tableCellSmall");
172 : //Einstellungen
173 0 : $code.= UserTools::getFormSubHeader($heading2, "tableSubHeaderDark", 3);
174 0 : $code.= UserTools::getOptionFormField("Anzeige", "showFlag", $this->contact['showFlag'], $showOptions, $this->styles, 300, 3);
175 : //hr
176 0 : $code.= "<tr><td class='tableCell' colspan='3'>\n";
177 0 : $code.= "<hr /></td></tr>\n";
178 : // buttons
179 0 : $code.= "<tr><td class='tableCell' colspan='3'>\n";
180 0 : $code.= "<div style='text-align:center;'>\n";
181 0 : $code.= "<p class='pForm'><input type='reset' value='Zurücksetzen'/></p>\n";
182 0 : $code.= "<p class='pForm'><input type='submit' name='updateContact' value='Speichern'/></p>\n";
183 0 : $code.= "</div></td></tr>\n";
184 0 : $code.= "</table>\n";
185 0 : $code.= "</form></td></tr>\n";
186 0 : echo $code;
187 0 : }
188 : }
|